package maire;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.File;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;

public class Reg {
	protected static FirefoxDriver dr = null;

	protected static Robot r = null;
	static {
		System.setProperty("webdriver.firefox.bin", "d:\\Firefox\\firefox.exe");

		FirefoxProfile fp = new FirefoxProfile();

		dr = new FirefoxDriver(fp);
		try {
			r = new Robot();
		} catch (AWTException e) {
			e.printStackTrace();
		}

	}

	public void sleep(long s) {
		try {
			Thread.sleep(s);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public void get(String url) {
		r.keyPress(KeyEvent.VK_CONTROL);
		r.keyPress(KeyEvent.VK_T);
		r.keyRelease(KeyEvent.VK_CONTROL);
		r.keyRelease(KeyEvent.VK_T);
		dr.get(url);
	}

	public void reg(String username, String password) throws Exception {
	}

	public static void main(String[] args) throws Exception {
		final String username = "aqqtmac16888";
		final String password = "Wen101570474";

		String[] all = { "sogou_com", "sina_com"/*
												 * , "sogou_com", "163_com",
												 * "21cn_com", "37_com",
												 * "yandex_com"
												 */};

		for (String a : all) {
			final Reg r = (Reg) Class.forName("nml.mail.reg.smtp." + a).newInstance();
			// new Thread(new Runnable() {

			// @Override
			// public void run() {
			r.reg(username, password);
			// }
			// }).start();
			// Thread.sleep(1000);

		}

	}

}
